/**
 * 
 */
package uk.ac.ebi.velvet.model.impl;

import org.apache.commons.lang.NotImplementedException;

import uk.ac.ebi.velvet.model.MapLocation;
import uk.ac.ebi.velvet.model.ReadPairedData;
import uk.ac.ebi.velvet.model.Strand;

/**
 * @author mhaimel
 *
 */
public class ReadPairedDataImpl implements ReadPairedData {
	
	private MapLocation rvsRead = null;
	private MapLocation fwdRead = null;

	@Override
	public MapLocation getRead(Strand str) {
		if(Strand.FWD.equals(str)){
			return getForwardRead();
		} else if (Strand.REV.equals(str)){
			return getReverseRead();
		} else {
			throw new NotImplementedException("Not yet implemented for :" + str);
		}
	}

	@Override
	public boolean hasRead(Strand str) {
		if(Strand.FWD.equals(str)){
			return hasForwardRead();
		} else if (Strand.REV.equals(str)){
			return hasReverseRead();
		} else {
			throw new NotImplementedException("Not yet implemented for :" + str);
		}
	}

	@Override
	public void setRead(MapLocation loc) {
		Strand str = loc.getReadOrientation();
		if(Strand.FWD.equals(str)){
			setForwardRead(loc);
		} else if (Strand.REV.equals(str)){
			setReverseRead(loc);
		} else {
			throw new NotImplementedException("Not yet implemented for :" + str);
		}
	}
	
	private MapLocation getReverseRead() {
		return rvsRead;
	}
	private boolean hasReverseRead() {
		return rvsRead != null;
	}
	private void setReverseRead(MapLocation loc) {
		this.rvsRead = loc;
	}
	private MapLocation getForwardRead() {
		return fwdRead;
	}
	private boolean hasForwardRead() {
		return fwdRead != null;
	}
	private void setForwardRead(MapLocation loc) {
		this.fwdRead = loc;
	}
}
